package org.algorithm.Queue;

import java.util.Iterator;

public class LinkedListQueue<E> implements Queue<E>
{
    private static class Node<E>
    {
        public Node(E value, Node<E> next) {
            this.value = value;
            this.next = next;
        }

        E value;
        Node<E> next;
    }

    //哨兵节点
    Node<E> head = new Node<>(null,null);
    Node<E> tail = head;

    public LinkedListQueue()
    {
        tail.next=head;
    }


    @Override
    public boolean offer(E value) {

        Node<E> added = new Node<>(value, head);
        tail.next=added;
        tail=added;
        return true;
    }

    @Override
    public E poll() {
        return null;
    }

    @Override
    public E peek() {
        return null;
    }

    @Override
    public boolean isEmpty() {
        return false;
    }
}
